import requests
import re
# # request()
# base_url = r'http://httpbin.org/'
# url = base_url + 'get'
# resp = requests.request('GET', url)
# print(resp.status_code)
#
# # get()
# resp = requests.get(url)
# print(resp.status_code)
# print(resp.text)
#
# # post()
# url = base_url + 'post'
# resp = requests.post(url)
# print(resp.status_code)
#
# # put()
# url = base_url + 'put'
# resp = requests.put(url)
# print(resp.status_code)
#
# # patch()
# url = base_url + 'patch'
# resp = requests.patch(url)
# print(resp.status_code)
#
# # delete()
# url = base_url + 'delete'
# resp = requests.delete(url)
# print(resp.status_code)


# 案例1：访问 ASMS 首页
# 案例2：访问 百度 首页
url = r'https://www.baidu.com/'
resp = requests.get(url)
resp.encoding = 'utf-8'
patt = r'<title>(.*?)</title>'
title = re.findall(patt, resp.text)
print(title)
# 案例3：访问 豆瓣电影 首页
url = r'https://movie.douban.com/'
resp = requests.get(url)
print(resp.status_code)
print(resp.text)